import type { Metadata } from "next";
import { Providers } from "./providers";
import { Toaster } from "react-hot-toast"
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import { memo, Suspense } from "react";
import Loading from "./loading";
import StoreProvider from "./StoreProvider";


const geistSans = Geist({
  variable: "--font-geist-sans",
  subsets: ["latin"],
});

const geistMono = Geist_Mono({
  variable: "--font-geist-mono",
  subsets: ["latin"],
});

export const metadata: Metadata = {
  title: "小佘佘毕设",
  description: "乱七八糟杂交系统",
};

const RootLayout = ({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) => {
  return (
    <html lang="en" className="dark">
      <body
        className={`${geistSans.variable} ${geistMono.variable} antialiased`}
      >
        <StoreProvider>
          <Providers>
            <Suspense fallback={<Loading />}>
              <div className="w-full min-h-svh bg-gradient-to-tr from-[#FFB457] to-[#FF705B] justify-center relative flex items-center border-default-200 dark:border-default-100 px-2 overflow-hidden">
                <Toaster />
                {children}
              </div>
            </Suspense>
          </Providers>
        </StoreProvider>
      </body>
    </html>
  );
}
export default memo(RootLayout)
